package com.esri.android.map.ags;

import android.util.Log;
import com.esri.core.ags.LayerServiceInfo;
import com.esri.core.geometry.Geometry;
import com.esri.core.internal.a;
import com.esri.core.internal.tasks.ags.v;
import com.esri.core.io.UserCredentials;
import com.esri.core.map.EditFieldsInfo;
import com.esri.core.map.FeatureTemplate;
import com.esri.core.map.FeatureType;
import com.esri.core.map.Field;
import com.esri.core.map.Graphic;
import com.esri.core.map.popup.PopupInfo;
import com.esri.core.portal.WebMapPopupInfo;
import com.esri.core.renderer.Renderer;
import com.esri.core.symbol.Symbol;

/* loaded from: classes.dex */
public class ArcGISPopupInfo extends PopupInfo {
    LayerServiceInfo a;
    boolean b;
    String c;

    public ArcGISPopupInfo(WebMapPopupInfo webMapPopupInfo) {
        super(webMapPopupInfo.getPopupInfo());
        this.b = false;
        this.c = webMapPopupInfo.getLayerUrl();
    }

    public ArcGISPopupInfo(PopupInfo popupInfo) {
        super(popupInfo);
        this.b = false;
    }

    public Field[] getFields() {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo == null) {
            return null;
        }
        return layerServiceInfo.getFields();
    }

    public Field getField(String str) {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo == null) {
            return null;
        }
        return layerServiceInfo.getField(str.toLowerCase());
    }

    public FeatureType getType(String str) {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo == null) {
            return null;
        }
        return layerServiceInfo.getSubType(str);
    }

    public String getTypeIdField() {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo == null) {
            return null;
        }
        return layerServiceInfo.getTypeIdField();
    }

    public String getLayerName() {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo == null) {
            return null;
        }
        return layerServiceInfo.getName();
    }

    public int getLayerId() {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo == null) {
            return -1;
        }
        return layerServiceInfo.getId();
    }

    public String getLayerUrl() {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo == null) {
            return null;
        }
        return layerServiceInfo.getURL();
    }

    public String getObjectIdField() {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo == null) {
            return null;
        }
        return layerServiceInfo.getObjectIdField();
    }

    public EditFieldsInfo getEditFieldsInfo() {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo == null) {
            return null;
        }
        return layerServiceInfo.getEditFieldsInfo();
    }

    public boolean isHasAttachments() {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo == null) {
            return true;
        }
        return layerServiceInfo.isHasAttachments();
    }

    public boolean isWebMapFeatureCollection() {
        return this.b;
    }

    public void setWebMapFeatureCollection(boolean z) {
        this.b = z;
    }

    public FeatureType[] getTypes() {
        if (this.a.getSubTypes() != null) {
            FeatureType[] featureTypeArr = new FeatureType[this.a.getSubTypes().length];
            System.arraycopy(this.a.getSubTypes(), 0, featureTypeArr, 0, this.a.getSubTypes().length);
            return featureTypeArr;
        }
        return null;
    }

    public String getDisplayField() {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo == null) {
            return null;
        }
        return layerServiceInfo.getDisplayField();
    }

    public Geometry.Type getGeometryType() {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo == null) {
            return null;
        }
        return layerServiceInfo.getGeometryType();
    }

    public Renderer getRenderer() {
        LayerServiceInfo layerServiceInfo = this.a;
        if (layerServiceInfo != null && layerServiceInfo.getDrawingInfo() != null && this.a.getDrawingInfo().getRenderer() != null) {
            try {
                return this.a.getDrawingInfo().getRenderer();
            } catch (ClassCastException e) {
                Log.e(a.a, "The symbol cannot be created.", e);
            }
        }
        return null;
    }

    public Symbol createSymbolFromTemplate(FeatureTemplate featureTemplate) {
        return createSymbolFromGraphic(new Graphic((Geometry) null, (Symbol) null, featureTemplate.getPrototype()));
    }

    public Symbol createSymbolFromGraphic(Graphic graphic) {
        Renderer renderer = getRenderer();
        if (renderer == null || graphic == null) {
            return null;
        }
        return renderer.getSymbol(graphic);
    }

    @Deprecated
    public void fetchLayerInfo(String str, UserCredentials userCredentials) throws Exception {
        this.a = new v(str, userCredentials).execute();
    }

    public void setLayer(LayerServiceInfo layerServiceInfo) {
        this.a = layerServiceInfo;
    }
}
